<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="卡号" prop="cardNumber">
        <el-input
          v-model="queryParams.cardNumber"
          placeholder="请输入卡号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="消费价值" prop="consumptionValue">
        <el-input
          v-model="queryParams.consumptionValue"
          placeholder="请输入消费价值"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="累计消费" prop="accumulatedConsumption">
        <el-input
          v-model="queryParams.accumulatedConsumption"
          placeholder="请输入累计消费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="剩余金额" prop="residualAmount">
        <el-input
          v-model="queryParams.residualAmount"
          placeholder="请输入剩余金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="剩余积分" prop="residualIntegral">
        <el-input
          v-model="queryParams.residualIntegral"
          placeholder="请输入剩余积分"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实存金额" prop="actualAmount">
        <el-input
          v-model="queryParams.actualAmount"
          placeholder="请输入实存金额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="存款消费" prop="depositConsumption">
        <el-input
          v-model="queryParams.depositConsumption"
          placeholder="请输入存款消费"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="净余额" prop="netBalance">
        <el-input
          v-model="queryParams.netBalance"
          placeholder="请输入净余额"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="消分日期" prop="cancellationDate">
        <el-date-picker clearable
          v-model="queryParams.cancellationDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择消分日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="使用日期" prop="dateUse">
        <el-date-picker clearable
          v-model="queryParams.dateUse"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择使用日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="出生日期" prop="dateBirth">
        <el-date-picker clearable
          v-model="queryParams.dateBirth"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择出生日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="折扣率" prop="discountRate">
        <el-input
          v-model="queryParams.discountRate"
          placeholder="请输入折扣率"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="续款次数" prop="numberRenewals">
        <el-input
          v-model="queryParams.numberRenewals"
          placeholder="请输入续款次数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="主卡号" prop="masterCardNumber">
        <el-input
          v-model="queryParams.masterCardNumber"
          placeholder="请输入主卡号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="赠卡标志" prop="giftCardSign">
        <el-input
          v-model="queryParams.giftCardSign"
          placeholder="请输入赠卡标志"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="售卡人" prop="cardSeller">
        <el-input
          v-model="queryParams.cardSeller"
          placeholder="请输入售卡人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input
          v-model="queryParams.password"
          placeholder="请输入密码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="兑换积分" prop="redeemPoints">
        <el-input
          v-model="queryParams.redeemPoints"
          placeholder="请输入兑换积分"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="累计积分" prop="cumulativeIntegral">
        <el-input
          v-model="queryParams.cumulativeIntegral"
          placeholder="请输入累计积分"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="会员柜号" prop="memberCounterNumber">
        <el-input
          v-model="queryParams.memberCounterNumber"
          placeholder="请输入会员柜号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="开户时间" prop="accountOpeningTime">
        <el-date-picker clearable
          v-model="queryParams.accountOpeningTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择开户时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="折扣方案" prop="discountScheme">
        <el-input
          v-model="queryParams.discountScheme"
          placeholder="请输入折扣方案"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="有效日期" prop="effectiveDate">
        <el-date-picker clearable
          v-model="queryParams.effectiveDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择有效日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="身份证" prop="idCard">
        <el-input
          v-model="queryParams.idCard"
          placeholder="请输入身份证"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="移动电话" prop="mobilePhone">
        <el-input
          v-model="queryParams.mobilePhone"
          placeholder="请输入移动电话"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="宅电" prop="homePhone">
        <el-input
          v-model="queryParams.homePhone"
          placeholder="请输入宅电"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工作单位" prop="workUnit">
        <el-input
          v-model="queryParams.workUnit"
          placeholder="请输入工作单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="地址" prop="address">
        <el-input
          v-model="queryParams.address"
          placeholder="请输入地址"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注" prop="note">
        <el-input
          v-model="queryParams.note"
          placeholder="请输入备注"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="优惠方案" prop="preferentialScheme">
        <el-input
          v-model="queryParams.preferentialScheme"
          placeholder="请输入优惠方案"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注1" prop="note1">
        <el-input
          v-model="queryParams.note1"
          placeholder="请输入备注1"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注2" prop="note2">
        <el-input
          v-model="queryParams.note2"
          placeholder="请输入备注2"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注3" prop="note3">
        <el-input
          v-model="queryParams.note3"
          placeholder="请输入备注3"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注4" prop="note4">
        <el-input
          v-model="queryParams.note4"
          placeholder="请输入备注4"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注5" prop="note5">
        <el-input
          v-model="queryParams.note5"
          placeholder="请输入备注5"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注6" prop="note6">
        <el-input
          v-model="queryParams.note6"
          placeholder="请输入备注6"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注7" prop="note7">
        <el-input
          v-model="queryParams.note7"
          placeholder="请输入备注7"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注8" prop="note8">
        <el-input
          v-model="queryParams.note8"
          placeholder="请输入备注8"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注9" prop="note9">
        <el-input
          v-model="queryParams.note9"
          placeholder="请输入备注9"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注10" prop="note10">
        <el-input
          v-model="queryParams.note10"
          placeholder="请输入备注10"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['project:form:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['project:form:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['project:form:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['project:form:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="formList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column label="卡号" align="center" prop="cardNumber" />
      <el-table-column label="姓名" align="center" prop="name" />
      <el-table-column label="消费价值" align="center" prop="consumptionValue" />
      <el-table-column label="累计消费" align="center" prop="accumulatedConsumption" />
      <el-table-column label="剩余金额" align="center" prop="residualAmount" />
      <el-table-column label="剩余积分" align="center" prop="residualIntegral" />
      <el-table-column label="类型" align="center" prop="type" />
      <el-table-column label="卡性质" align="center" prop="cardNature" />
      <el-table-column label="实存金额" align="center" prop="actualAmount" />
      <el-table-column label="存款消费" align="center" prop="depositConsumption" />
      <el-table-column label="净余额" align="center" prop="netBalance" />
      <el-table-column label="消分日期" align="center" prop="cancellationDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.cancellationDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="使用日期" align="center" prop="dateUse" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.dateUse, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="出生日期" align="center" prop="dateBirth" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.dateBirth, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="折扣率" align="center" prop="discountRate" />
      <el-table-column label="续款次数" align="center" prop="numberRenewals" />
      <el-table-column label="卡状态" align="center" prop="cardStatus" />
      <el-table-column label="主卡号" align="center" prop="masterCardNumber" />
      <el-table-column label="性别" align="center" prop="sex" />
      <el-table-column label="赠卡标志" align="center" prop="giftCardSign" />
      <el-table-column label="售卡人" align="center" prop="cardSeller" />
      <el-table-column label="密码" align="center" prop="password" />
      <el-table-column label="兑换积分" align="center" prop="redeemPoints" />
      <el-table-column label="累计积分" align="center" prop="cumulativeIntegral" />
      <el-table-column label="会员柜号" align="center" prop="memberCounterNumber" />
      <el-table-column label="开户时间" align="center" prop="accountOpeningTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.accountOpeningTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="折扣方案" align="center" prop="discountScheme" />
      <el-table-column label="有效日期" align="center" prop="effectiveDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.effectiveDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="身份证" align="center" prop="idCard" />
      <el-table-column label="移动电话" align="center" prop="mobilePhone" />
      <el-table-column label="宅电" align="center" prop="homePhone" />
      <el-table-column label="工作单位" align="center" prop="workUnit" />
      <el-table-column label="地址" align="center" prop="address" />
      <el-table-column label="备注" align="center" prop="note" />
      <el-table-column label="优惠方案" align="center" prop="preferentialScheme" />
      <el-table-column label="备注1" align="center" prop="note1" />
      <el-table-column label="备注2" align="center" prop="note2" />
      <el-table-column label="备注3" align="center" prop="note3" />
      <el-table-column label="备注4" align="center" prop="note4" />
      <el-table-column label="备注5" align="center" prop="note5" />
      <el-table-column label="备注6" align="center" prop="note6" />
      <el-table-column label="备注7" align="center" prop="note7" />
      <el-table-column label="备注8" align="center" prop="note8" />
      <el-table-column label="备注9" align="center" prop="note9" />
      <el-table-column label="备注10" align="center" prop="note10" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['project:form:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['project:form:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改会员对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="卡号" prop="cardNumber">
          <el-input v-model="form.cardNumber" placeholder="请输入卡号" />
        </el-form-item>
        <el-form-item label="姓名" prop="name">
          <el-input v-model="form.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="消费价值" prop="consumptionValue">
          <el-input v-model="form.consumptionValue" placeholder="请输入消费价值" />
        </el-form-item>
        <el-form-item label="累计消费" prop="accumulatedConsumption">
          <el-input v-model="form.accumulatedConsumption" placeholder="请输入累计消费" />
        </el-form-item>
        <el-form-item label="剩余金额" prop="residualAmount">
          <el-input v-model="form.residualAmount" placeholder="请输入剩余金额" />
        </el-form-item>
        <el-form-item label="剩余积分" prop="residualIntegral">
          <el-input v-model="form.residualIntegral" placeholder="请输入剩余积分" />
        </el-form-item>
        <el-form-item label="实存金额" prop="actualAmount">
          <el-input v-model="form.actualAmount" placeholder="请输入实存金额" />
        </el-form-item>
        <el-form-item label="存款消费" prop="depositConsumption">
          <el-input v-model="form.depositConsumption" placeholder="请输入存款消费" />
        </el-form-item>
        <el-form-item label="净余额" prop="netBalance">
          <el-input v-model="form.netBalance" placeholder="请输入净余额" />
        </el-form-item>
        <el-form-item label="消分日期" prop="cancellationDate">
          <el-date-picker clearable
            v-model="form.cancellationDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择消分日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="使用日期" prop="dateUse">
          <el-date-picker clearable
            v-model="form.dateUse"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择使用日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="出生日期" prop="dateBirth">
          <el-date-picker clearable
            v-model="form.dateBirth"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择出生日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="折扣率" prop="discountRate">
          <el-input v-model="form.discountRate" placeholder="请输入折扣率" />
        </el-form-item>
        <el-form-item label="续款次数" prop="numberRenewals">
          <el-input v-model="form.numberRenewals" placeholder="请输入续款次数" />
        </el-form-item>
        <el-form-item label="主卡号" prop="masterCardNumber">
          <el-input v-model="form.masterCardNumber" placeholder="请输入主卡号" />
        </el-form-item>
        <el-form-item label="赠卡标志" prop="giftCardSign">
          <el-input v-model="form.giftCardSign" placeholder="请输入赠卡标志" />
        </el-form-item>
        <el-form-item label="售卡人" prop="cardSeller">
          <el-input v-model="form.cardSeller" placeholder="请输入售卡人" />
        </el-form-item>
        <el-form-item label="密码" prop="password">
          <el-input v-model="form.password" placeholder="请输入密码" />
        </el-form-item>
        <el-form-item label="兑换积分" prop="redeemPoints">
          <el-input v-model="form.redeemPoints" placeholder="请输入兑换积分" />
        </el-form-item>
        <el-form-item label="累计积分" prop="cumulativeIntegral">
          <el-input v-model="form.cumulativeIntegral" placeholder="请输入累计积分" />
        </el-form-item>
        <el-form-item label="会员柜号" prop="memberCounterNumber">
          <el-input v-model="form.memberCounterNumber" placeholder="请输入会员柜号" />
        </el-form-item>
        <el-form-item label="开户时间" prop="accountOpeningTime">
          <el-date-picker clearable
            v-model="form.accountOpeningTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择开户时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="折扣方案" prop="discountScheme">
          <el-input v-model="form.discountScheme" placeholder="请输入折扣方案" />
        </el-form-item>
        <el-form-item label="有效日期" prop="effectiveDate">
          <el-date-picker clearable
            v-model="form.effectiveDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择有效日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="身份证" prop="idCard">
          <el-input v-model="form.idCard" placeholder="请输入身份证" />
        </el-form-item>
        <el-form-item label="移动电话" prop="mobilePhone">
          <el-input v-model="form.mobilePhone" placeholder="请输入移动电话" />
        </el-form-item>
        <el-form-item label="宅电" prop="homePhone">
          <el-input v-model="form.homePhone" placeholder="请输入宅电" />
        </el-form-item>
        <el-form-item label="工作单位" prop="workUnit">
          <el-input v-model="form.workUnit" placeholder="请输入工作单位" />
        </el-form-item>
        <el-form-item label="地址" prop="address">
          <el-input v-model="form.address" placeholder="请输入地址" />
        </el-form-item>
        <el-form-item label="备注" prop="note">
          <el-input v-model="form.note" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="优惠方案" prop="preferentialScheme">
          <el-input v-model="form.preferentialScheme" placeholder="请输入优惠方案" />
        </el-form-item>
        <el-form-item label="备注1" prop="note1">
          <el-input v-model="form.note1" placeholder="请输入备注1" />
        </el-form-item>
        <el-form-item label="备注2" prop="note2">
          <el-input v-model="form.note2" placeholder="请输入备注2" />
        </el-form-item>
        <el-form-item label="备注3" prop="note3">
          <el-input v-model="form.note3" placeholder="请输入备注3" />
        </el-form-item>
        <el-form-item label="备注4" prop="note4">
          <el-input v-model="form.note4" placeholder="请输入备注4" />
        </el-form-item>
        <el-form-item label="备注5" prop="note5">
          <el-input v-model="form.note5" placeholder="请输入备注5" />
        </el-form-item>
        <el-form-item label="备注6" prop="note6">
          <el-input v-model="form.note6" placeholder="请输入备注6" />
        </el-form-item>
        <el-form-item label="备注7" prop="note7">
          <el-input v-model="form.note7" placeholder="请输入备注7" />
        </el-form-item>
        <el-form-item label="备注8" prop="note8">
          <el-input v-model="form.note8" placeholder="请输入备注8" />
        </el-form-item>
        <el-form-item label="备注9" prop="note9">
          <el-input v-model="form.note9" placeholder="请输入备注9" />
        </el-form-item>
        <el-form-item label="备注10" prop="note10">
          <el-input v-model="form.note10" placeholder="请输入备注10" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listForm, getForm, delForm, addForm, updateForm } from "@/api/project/form";

export default {
  name: "Form",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 会员表格数据
      formList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        cardNumber: null,
        name: null,
        consumptionValue: null,
        accumulatedConsumption: null,
        residualAmount: null,
        residualIntegral: null,
        type: null,
        cardNature: null,
        actualAmount: null,
        depositConsumption: null,
        netBalance: null,
        cancellationDate: null,
        dateUse: null,
        dateBirth: null,
        discountRate: null,
        numberRenewals: null,
        cardStatus: null,
        masterCardNumber: null,
        sex: null,
        giftCardSign: null,
        cardSeller: null,
        password: null,
        redeemPoints: null,
        cumulativeIntegral: null,
        memberCounterNumber: null,
        accountOpeningTime: null,
        discountScheme: null,
        effectiveDate: null,
        idCard: null,
        mobilePhone: null,
        homePhone: null,
        workUnit: null,
        address: null,
        note: null,
        preferentialScheme: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询会员列表 */
    getList() {
      this.loading = true;
      listForm(this.queryParams).then(response => {
        this.formList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        cardNumber: null,
        name: null,
        consumptionValue: null,
        accumulatedConsumption: null,
        residualAmount: null,
        residualIntegral: null,
        type: null,
        cardNature: null,
        actualAmount: null,
        depositConsumption: null,
        netBalance: null,
        cancellationDate: null,
        dateUse: null,
        dateBirth: null,
        discountRate: null,
        numberRenewals: null,
        cardStatus: null,
        masterCardNumber: null,
        sex: null,
        giftCardSign: null,
        cardSeller: null,
        password: null,
        redeemPoints: null,
        cumulativeIntegral: null,
        memberCounterNumber: null,
        accountOpeningTime: null,
        discountScheme: null,
        effectiveDate: null,
        idCard: null,
        mobilePhone: null,
        homePhone: null,
        workUnit: null,
        address: null,
        note: null,
        preferentialScheme: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加会员";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getForm(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改会员";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateForm(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addForm(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除会员编号为"' + ids + '"的数据项？').then(function() {
        return delForm(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('project/form/export', {
        ...this.queryParams
      }, `form_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
